<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <title>兴趣测试 - 发现你的爱好</title>
    <!-- Bootstrap 5 CSS -->
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
    <!-- Font Awesome 图标 -->
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css">
    
    <style>
        :root {
            --primary: #6366f1;
            --primary-light: #a5b4fc;
            --primary-dark: #4338ca;
            --secondary: #10b981;
            --accent: #f97316;
            --danger: #ef4444;
            --text-primary: #1f2937;
            --text-secondary: #6b7280;
            --text-light: #9ca3af;
            --bg-light: #f3f4f6;
            --bg-white: #ffffff;
            --border-light: #e5e7eb;
            --radius: 12px;
            --shadow: 0 2px 15px rgba(0, 0, 0, 0.05);
        }
        
        body {
            font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
            background-color: var(--bg-light);
            color: var(--text-primary);
            padding-top: 55px;
            padding-bottom: 70px;
        }
        
        /* 顶部导航 */
        .top-nav {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            height: 55px;
            background-color: var(--bg-white);
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 0 15px;
            z-index: 1000;
            border-bottom: 1px solid var(--border-light);
            box-shadow: var(--shadow);
        }
        
        .nav-title {
            font-size: 1.15rem;
            font-weight: 600;
            color: var(--primary-dark);
        }
        
        .nav-action {
            color: var(--text-secondary);
            background: none;
            border: none;
            font-size: 1.2rem;
            width: 40px;
            height: 40px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
        }
        
        .nav-action:hover {
            background-color: var(--bg-light);
        }
        
        /* 搜索栏 */
        .search-container {
            padding: 12px 15px;
            background-color: var(--bg-white);
        }
        
        .search-group {
            position: relative;
        }
        
        .search-input {
            width: 100%;
            padding: 12px 15px 12px 45px;
            border-radius: 30px;
            border: 1px solid var(--border-light);
            background-color: var(--bg-light);
            font-size: 0.9rem;
        }
        
        .search-input:focus {
            outline: none;
            border-color: var(--primary-light);
            box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.1);
        }
        
        .search-icon {
            position: absolute;
            left: 15px;
            top: 50%;
            transform: translateY(-50%);
            color: var(--text-secondary);
        }
        
        /* 分类筛选栏 */
        .category-filter {
            display: flex;
            padding: 8px 15px;
            background-color: var(--bg-white);
            border-top: 1px solid var(--border-light);
            overflow-x: auto;
            scrollbar-width: none;
        }
        
        .category-filter::-webkit-scrollbar {
            display: none;
        }
        
        .category-item {
            white-space: nowrap;
            padding: 6px 14px;
            margin-right: 8px;
            border-radius: 20px;
            font-size: 0.85rem;
            background-color: var(--bg-light);
            color: var(--text-secondary);
            border: none;
            display: flex;
            align-items: center;
        }
        
        .category-item.active {
            background-color: var(--primary);
            color: white;
        }
        
        .category-item i {
            margin-right: 5px;
        }
        
        /* 测试列表 */
        .quizzes-list {
            padding: 0 15px;
        }
        
        .quiz-card {
            background-color: var(--bg-white);
            border-radius: var(--radius);
            margin-top: 12px;
            overflow: hidden;
            box-shadow: var(--shadow);
            transition: transform 0.2s ease;
        }
        
        .quiz-card:hover {
            transform: translateY(-2px);
        }
        
        /* 无图测试卡片 */
        .quiz-card.no-image .card-body {
            padding: 18px 15px;
        }
        
        /* 单图测试卡片 */
        .quiz-card.single-image .card-image {
            height: 180px;
        }
        
        /* 多图测试卡片 */
        .card-image-container {
            position: relative;
        }
        
        .card-image {
            width: 100%;
            height: 160px;
            object-fit: cover;
        }
        
        .multi-image {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: 3px;
            height: 160px;
        }
        
        .multi-image img {
            width: 100%;
            height: 100%;
            object-fit: cover;
        }
        
        .image-count {
            position: absolute;
            right: 8px;
            bottom: 8px;
            background-color: rgba(0, 0, 0, 0.6);
            color: white;
            font-size: 0.75rem;
            padding: 2px 8px;
            border-radius: 10px;
        }
        
        /* 测试卡片内容 */
        .card-body {
            padding: 15px;
        }
        
        .quiz-category {
            display: inline-block;
            background-color: rgba(99, 102, 241, 0.1);
            color: var(--primary);
            font-size: 0.75rem;
            padding: 3px 10px;
            border-radius: 12px;
            margin-bottom: 8px;
        }
        
        .quiz-title {
            font-size: 1.1rem;
            font-weight: 600;
            margin-bottom: 8px;
            line-height: 1.4;
        }
        
        .quiz-description {
            font-size: 0.9rem;
            line-height: 1.5;
            color: var(--text-secondary);
            margin-bottom: 12px;
            display: -webkit-box;
            -webkit-line-clamp: 2;
            -webkit-box-orient: vertical;
            overflow: hidden;
        }
        
        /* 测试元数据 */
        .quiz-meta {
            display: flex;
            justify-content: space-between;
            align-items: center;
            font-size: 0.8rem;
            color: var(--text-light);
            margin-bottom: 12px;
        }
        
        .meta-item {
            display: flex;
            align-items: center;
            gap: 5px;
        }
        
        /* 测试进度 */
        .quiz-progress {
            height: 6px;
            background-color: var(--bg-light);
            border-radius: 3px;
            overflow: hidden;
            margin-bottom: 12px;
        }
        
        .progress-bar {
            height: 100%;
            background-color: var(--primary);
            border-radius: 3px;
        }
        
        .progress-text {
            display: flex;
            justify-content: space-between;
            font-size: 0.8rem;
            color: var(--text-light);
            margin-top: 5px;
            margin-bottom: 12px;
        }
        
        /* 操作按钮 */
        .action-buttons {
            display: flex;
            gap: 10px;
        }
        
        .primary-btn {
            flex: 1;
            padding: 10px 0;
            background-color: var(--primary);
            color: white;
            border: none;
            border-radius: 8px;
            font-size: 0.9rem;
            font-weight: 500;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 5px;
        }
        
        .primary-btn:hover {
            background-color: var(--primary-dark);
        }
        
        .secondary-btn {
            flex: 0 0 auto;
            padding: 10px;
            background-color: var(--bg-light);
            color: var(--text-secondary);
            border: none;
            border-radius: 8px;
            font-size: 0.9rem;
            font-weight: 500;
            display: flex;
            align-items: center;
            justify-content: center;
        }
        
        .secondary-btn:hover {
            background-color: #e5e7eb;
        }
        
        /* 精选测试标签 */
        .featured-badge {
            position: absolute;
            top: 10px;
            left: 10px;
            background-color: var(--accent);
            color: white;
            font-size: 0.7rem;
            padding: 2px 8px;
            border-radius: 4px;
            z-index: 10;
        }
        
        /* 加载更多 */
        .load-more {
            width: 100%;
            padding: 12px;
            margin: 15px 0;
            background-color: var(--bg-white);
            border: 1px solid var(--border-light);
            border-radius: var(--radius);
            color: var(--text-secondary);
            font-size: 0.9rem;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
        }
        
        /* 底部导航 */
        .bottom-nav {
            position: fixed;
            bottom: 0;
            left: 0;
            right: 0;
            height: 65px;
            background-color: var(--bg-white);
            display: flex;
            justify-content: space-around;
            align-items: center;
            border-top: 1px solid var(--border-light);
            z-index: 1000;
        }
        
        .nav-item {
            display: flex;
            flex-direction: column;
            align-items: center;
            color: var(--text-secondary);
            font-size: 0.7rem;
            text-decoration: none;
        }
        
        .nav-item i {
            font-size: 1.3rem;
            margin-bottom: 3px;
        }
        
        .nav-item.active {
            color: var(--primary);
        }
        
        /* 提示消息 */
        .toast-notification {
            position: fixed;
            bottom: 80px;
            left: 50%;
            transform: translateX(-50%);
            background-color: rgba(0, 0, 0, 0.7);
            color: white;
            padding: 8px 16px;
            border-radius: 4px;
            z-index: 9999;
            font-size: 0.9rem;
            opacity: 0;
            transition: opacity 0.3s ease;
        }
        
        .toast-notification.show {
            opacity: 1;
        }
    </style>
</head>
<body>
    <!-- 顶部导航 -->
    <div class="top-nav">
        <button class="nav-action">
            <i class="fas fa-arrow-left"></i>
        </button>
        <div class="nav-title">兴趣测试</div>
        <button class="nav-action">
            <i class="fas fa-cog"></i>
        </button>
    </div>
    
    <!-- 搜索栏 -->
    <div class="search-container">
        <div class="search-group">
            <i class="fas fa-search search-icon"></i>
            <input type="text" class="search-input" placeholder="搜索兴趣测试...">
        </div>
    </div>
    
    <!-- 分类筛选栏 -->
    <div class="category-filter">
        <button class="category-item active">
            <i class="fas fa-th"></i>全部
        </button>
        <button class="category-item">
            <i class="fas fa-music"></i>音乐
        </button>
        <button class="category-item">
            <i class="fas fa-film"></i>影视
        </button>
        <button class="category-item">
            <i class="fas fa-book"></i>文学
        </button>
        <button class="category-item">
            <i class="fas fa-utensils"></i>美食
        </button>
        <button class="category-item">
            <i class="fas fa-plane"></i>旅行
        </button>
        <button class="category-item">
            <i class="fas fa-gamepad"></i>游戏
        </button>
        <button class="category-item">
            <i class="fas fa-palette"></i>艺术
        </button>
    </div>
    
    <!-- 测试列表 -->
    <div class="quizzes-list">
        <!-- 无图测试卡片 -->
        <div class="quiz-card no-image">
            <div class="card-body">
                <span class="quiz-category">性格测试</span>
                <h3 class="quiz-title">你的隐藏性格是什么？从10个问题看穿真实的你</h3>
                <p class="quiz-description">这个测试将通过你对日常场景的选择，分析出你隐藏的性格特质，帮助你更好地了解自己。</p>
                
                <div class="quiz-meta">
                    <div class="meta-item">
                        <i class="fas fa-question-circle"></i>
                        <span>10题</span>
                    </div>
                    <div class="meta-item">
                        <i class="fas fa-users"></i>
                        <span>12.5k人参与</span>
                    </div>
                    <div class="meta-item">
                        <i class="fas fa-star"></i>
                        <span>4.8分</span>
                    </div>
                </div>
                
                <div class="action-buttons">
                    <button class="primary-btn">
                        <i class="fas fa-play"></i> 开始测试
                    </button>
                    <button class="secondary-btn favorite-btn">
                        <i class="far fa-bookmark"></i>
                    </button>
                </div>
            </div>
        </div>
        
        <!-- 单图测试卡片 -->
        <div class="quiz-card single-image">
            <div class="card-image-container">
                <img src="https://picsum.photos/id/1068/800/400" alt="音乐测试封面" class="card-image">
                <span class="featured-badge">精选</span>
            </div>
            <div class="card-body">
                <span class="quiz-category">音乐</span>
                <h3 class="quiz-title">根据你的听歌习惯，测试你的音乐品味类型</h3>
                <p class="quiz-description">通过你对不同音乐风格的偏好，分析你的音乐品味类型，并推荐适合你的新歌单。</p>
                
                <div class="quiz-meta">
                    <div class="meta-item">
                        <i class="fas fa-question-circle"></i>
                        <span>15题</span>
                    </div>
                    <div class="meta-item">
                        <i class="fas fa-users"></i>
                        <span>8.7k人参与</span>
                    </div>
                    <div class="meta-item">
                        <i class="fas fa-star"></i>
                        <span>4.9分</span>
                    </div>
                </div>
                
                <div class="action-buttons">
                    <button class="primary-btn">
                        <i class="fas fa-play"></i> 开始测试
                    </button>
                    <button class="secondary-btn favorite-btn">
                        <i class="far fa-bookmark"></i>
                    </button>
                </div>
            </div>
        </div>
        
        <!-- 多图测试卡片 -->
        <div class="quiz-card multi-image-card">
            <div class="card-image-container">
                <div class="multi-image">
                    <img src="https://picsum.photos/id/292/300/300" alt="美食测试图片1">
                    <img src="https://picsum.photos/id/431/300/300" alt="美食测试图片2">
                    <img src="https://picsum.photos/id/488/300/300" alt="美食测试图片3">
                </div>
                <div class="image-count">10图</div>
            </div>
            <div class="card-body">
                <span class="quiz-category">美食</span>
                <h3 class="quiz-title">从食物选择看你的性格，你是哪种美食爱好者？</h3>
                <p class="quiz-description">通过你对不同食物的偏好和选择方式，分析你的性格特点和生活态度。</p>
                
                <div class="quiz-meta">
                    <div class="meta-item">
                        <i class="fas fa-question-circle"></i>
                        <span>20题</span>
                    </div>
                    <div class="meta-item">
                        <i class="fas fa-users"></i>
                        <span>15.2k人参与</span>
                    </div>
                    <div class="meta-item">
                        <i class="fas fa-star"></i>
                        <span>4.7分</span>
                    </div>
                </div>
                
                <div class="action-buttons">
                    <button class="primary-btn">
                        <i class="fas fa-play"></i> 开始测试
                    </button>
                    <button class="secondary-btn favorite-btn">
                        <i class="fas fa-bookmark"></i>
                    </button>
                </div>
            </div>
        </div>
        
        <!-- 进行中的测试卡片 -->
        <div class="quiz-card no-image">
            <div class="card-body">
                <span class="quiz-category">旅行</span>
                <h3 class="quiz-title">你的旅行风格是什么？测试适合你的旅行目的地</h3>
                <p class="quiz-description">通过你的旅行习惯和偏好，推荐最适合你的旅行目的地和旅行方式。</p>
                
                <div class="quiz-meta">
                    <div class="meta-item">
                        <i class="fas fa-question-circle"></i>
                        <span>12题</span>
                    </div>
                    <div class="meta-item">
                        <i class="fas fa-users"></i>
                        <span>7.3k人参与</span>
                    </div>
                    <div class="meta-item">
                        <i class="fas fa-star"></i>
                        <span>4.6分</span>
                    </div>
                </div>
                
                <div class="quiz-progress">
                    <div class="progress-bar" style="width: 60%"></div>
                </div>
                
                <div class="progress-text">
                    <span>已完成6/12题</span>
                    <span>60%</span>
                </div>
                
                <div class="action-buttons">
                    <button class="primary-btn">
                        <i class="fas fa-redo"></i> 继续测试
                    </button>
                    <button class="secondary-btn favorite-btn">
                        <i class="far fa-bookmark"></i>
                    </button>
                </div>
            </div>
        </div>
        
        <!-- 影视类测试卡片 -->
        <div class="quiz-card single-image">
            <div class="card-image-container">
                <img src="https://picsum.photos/id/111/800/400" alt="影视测试封面" class="card-image">
            </div>
            <div class="card-body">
                <span class="quiz-category">影视</span>
                <h3 class="quiz-title">根据你的观影喜好，测试你是哪种电影迷</h3>
                <p class="quiz-description">从你喜欢的电影类型、导演和演员，分析你的电影品味和性格特点。</p>
                
                <div class="quiz-meta">
                    <div class="meta-item">
                        <i class="fas fa-question-circle"></i>
                        <span>18题</span>
                    </div>
                    <div class="meta-item">
                        <i class="fas fa-users"></i>
                        <span>9.8k人参与</span>
                    </div>
                    <div class="meta-item">
                        <i class="fas fa-star"></i>
                        <span>4.8分</span>
                    </div>
                </div>
                
                <div class="action-buttons">
                    <button class="primary-btn">
                        <i class="fas fa-play"></i> 开始测试
                    </button>
                    <button class="secondary-btn favorite-btn">
                        <i class="far fa-bookmark"></i>
                    </button>
                </div>
            </div>
        </div>
        
        <!-- 加载更多 -->
        <button class="load-more">
            <i class="fas fa-spinner fa-spin"></i>
            <span>加载更多测试</span>
        </button>
    </div>
    
    <!-- 底部导航 -->
    <div class="bottom-nav">
        <a href="#" class="nav-item">
            <i class="fas fa-home"></i>
            <span>首页</span>
        </a>
        <a href="#" class="nav-item active">
            <i class="fas fa-clipboard-check"></i>
            <span>测试</span>
        </a>
        <a href="#" class="nav-item">
            <i class="fas fa-compass"></i>
            <span>发现</span>
        </a>
        <a href="#" class="nav-item">
            <i class="far fa-user"></i>
            <span>我的</span>
        </a>
    </div>
    
    <!-- Bootstrap JS Bundle with Popper -->
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
    
    <script>
        // 分类筛选切换
        const categoryItems = document.querySelectorAll('.category-item');
        categoryItems.forEach(item => {
            item.addEventListener('click', () => {
                categoryItems.forEach(i => i.classList.remove('active'));
                item.classList.add('active');
                const category = item.textContent.trim();
                showToast(`已切换到${category}分类`);
                loadQuizzesByCategory(category);
            });
        });
        
        // 收藏功能
        const favoriteButtons = document.querySelectorAll('.favorite-btn');
        favoriteButtons.forEach(btn => {
            btn.addEventListener('click', () => {
                const icon = btn.querySelector('i');
                
                if (icon.classList.contains('far')) {
                    icon.classList.remove('far');
                    icon.classList.add('fas');
                    icon.style.color = '#6366f1';
                    showToast('收藏成功');
                } else {
                    icon.classList.remove('fas');
                    icon.classList.add('far');
                    icon.style.color = '';
                    showToast('取消收藏');
                }
            });
        });
        
        // 开始/继续测试
        const startButtons = document.querySelectorAll('.primary-btn');
        startButtons.forEach(btn => {
            btn.addEventListener('click', () => {
                const quizTitle = btn.closest('.quiz-card').querySelector('.quiz-title').textContent;
                showToast(`正在进入测试：${quizTitle}`);
                // 实际应用中，这里会跳转到测试详情页
            });
        });
        
        // 加载更多测试
        document.querySelector('.load-more').addEventListener('click', function() {
            const btn = this;
            const originalText = btn.innerHTML;
            btn.innerHTML = '<i class="fas fa-spinner fa-spin"></i><span>加载中...</span>';
            btn.disabled = true;
            
            // 模拟加载延迟
            setTimeout(() => {
                btn.innerHTML = originalText;
                btn.disabled = false;
                showToast('已加载更多测试');
                
                // 复制第一个测试卡片并修改内容
                const quizzesList = document.querySelector('.quizzes-list');
                const firstCard = quizzesList.querySelector('.quiz-card:first-of-type');
                
                if (firstCard) {
                    const clone = firstCard.cloneNode(true);
                    // 修改一些内容以示区别
                    const randomId = Math.floor(Math.random() * 100) + 200;
                    if (clone.querySelector('.card-image')) {
                        clone.querySelector('.card-image').src = `https://picsum.photos/id/${randomId}/800/400`;
                    }
                    
                    // 重置收藏状态
                    const favoriteBtn = clone.querySelector('.favorite-btn');
                    if (favoriteBtn.querySelector('.fas.fa-bookmark')) {
                        favoriteBtn.innerHTML = '<i class="far fa-bookmark"></i>';
                    }
                    
                    // 插入到加载更多按钮前
                    quizzesList.insertBefore(clone, btn);
                    
                    // 重新绑定事件
                    bindEvents();
                }
            }, 1500);
        });
        
        // 返回按钮
        document.querySelector('.top-nav .nav-action:first-child').addEventListener('click', () => {
            showToast('返回上一页');
            // 实际应用中，这里会返回上一页
        });
        
        // 根据分类加载测试
        function loadQuizzesByCategory(category) {
            const quizzesList = document.querySelector('.quizzes-list');
            const originalContent = quizzesList.innerHTML;
            
            // 显示加载状态
            quizzesList.innerHTML = `
                <div class="quiz-card no-image">
                    <div class="card-body">
                        <div class="skeleton" style="width: 80px; height: 24px; border-radius: 12px; margin-bottom: 10px;"></div>
                        <div class="skeleton" style="width: 100%; height: 24px; border-radius: 4px; margin-bottom: 8px;"></div>
                        <div class="skeleton" style="width: 80%; height: 20px; border-radius: 4px; margin-bottom: 15px;"></div>
                        <div class="skeleton" style="width: 100%; height: 16px; border-radius: 4px; margin-bottom: 8px;"></div>
                        <div class="skeleton" style="width: 100%; height: 40px; border-radius: 8px; margin-top: 15px;"></div>
                    </div>
                </div>
                <button class="load-more">
                    <i class="fas fa-spinner fa-spin"></i>
                    <span>加载中...</span>
                </button>
            `;
            
            // 模拟加载延迟
            setTimeout(() => {
                quizzesList.innerHTML = originalContent;
                bindEvents();
            }, 1000);
        }
        
        // 绑定事件
        function bindEvents() {
            // 重新绑定收藏按钮事件
            const newFavoriteButtons = document.querySelectorAll('.favorite-btn:not([data-bound])');
            newFavoriteButtons.forEach(btn => {
                btn.setAttribute('data-bound', 'true');
                btn.addEventListener('click', () => {
                    const icon = btn.querySelector('i');
                    
                    if (icon.classList.contains('far')) {
                        icon.classList.remove('far');
                        icon.classList.add('fas');
                        icon.style.color = '#6366f1';
                        showToast('收藏成功');
                    } else {
                        icon.classList.remove('fas');
                        icon.classList.add('far');
                        icon.style.color = '';
                        showToast('取消收藏');
                    }
                });
            });
            
            // 重新绑定开始测试按钮事件
            const newStartButtons = document.querySelectorAll('.primary-btn:not([data-bound])');
            newStartButtons.forEach(btn => {
                btn.setAttribute('data-bound', 'true');
                btn.addEventListener('click', () => {
                    const quizTitle = btn.closest('.quiz-card').querySelector('.quiz-title').textContent;
                    showToast(`正在进入测试：${quizTitle}`);
                });
            });
        }
        
        // 提示消息
        function showToast(message) {
            // 检查是否已有toast
            let toast = document.querySelector('.toast-notification');
            if (toast) {
                toast.remove();
            }
            
            // 创建新toast
            toast = document.createElement('div');
            toast.className = 'toast-notification';
            toast.textContent = message;
            
            document.body.appendChild(toast);
            
            // 显示toast
            setTimeout(() => {
                toast.classList.add('show');
            }, 10);
            
            // 3秒后隐藏并移除
            setTimeout(() => {
                toast.classList.remove('show');
                setTimeout(() => toast.remove(), 300);
            }, 3000);
        }
        
        // 初始化绑定事件
        bindEvents();
    </script>
</body>
</html>

